<%@ Page Language="C#" Inherits="My.Blog.Web.Controllers.BasePage" AutoEventWireup="false" %>
<%@import namespace="System" %>
<%@import namespace="System.Threading" %>
<%@import namespace="System.Collections.Generic" %>
<%@import namespace="My.Blog.Domain.Entities" %>
<%@import namespace="My.Blog.Domain.Interfaces" %>
<%@import namespace="My.Blog.Business.Service" %>
<%@import namespace="My.Blog.Business.Security" %>
<%@import namespace="My.Blog.Web.Controllers" %>
<%@import namespace="My.Blog.Web.UI" %>
<script runat="server">
/////////////////////////////////////////////////////////////////
//File: BlogInfo.cs
//Description: 
//  Ajax 代码
//  
//Copyright© 2011 Moliu
//History:
//  2011-3-13 9:02:14    CodeSmith5.0.1    Original Version
/////////////////////////////////////////////////////////////////
</script>
<%
    BlogHandler _BlogHandler = new BlogHandler(this);
    IList<BlogInfo> thisList = _BlogHandler.ReadBlogsByConditions();
%>
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>博客列表页</title>
    <link type="text/css" rel="Stylesheet" href="_Resources/V1/Css/Layout.css" />
    <script type="text/javascript" src="_Resources/Common/Js/jquery.pack.js"></script>
    <script type="text/javascript" src="_Resources/Common/Js/jquery.plugins.js"></script>
</head>
<body>
<div>
    <% new Header(); %>
</div>
    
<div id="container">   
    <div id="header">
        <% new HeaderPublic(); %>
    </div>
    
    <div id="breadcrumb">
        <span class="link"><a href="Index.aspx" title="首页">首页</a></span>
        <span class="divider">&gt;</span>
        <span class="target">博客列表</span>
    </div>

    <form id="FrmDeleteBlogs" method="post" action="<%=this.RootUrl %>/_Ajax/Blog.aspx?op=DeleteBlogs">
    <h1>Blogs列表</h1>
    <div>
    <%
        if( null==thisList || 0==thisList.Count )
        {        
    %>
        <p>目前还没有博主进驻！</p>
    <%
        }
        else
        {
            Response.Write("<ul>");
            foreach( BlogInfo info in thisList )
            {
                string s = "";
                if (SecurityUtility.IsBlogAdmin && this.IsMasterMode)
                    s = "<input name='Ids' type='checkbox' value=" + info.Id + " />";
                    
                Response.Write(string.Format(
                    "<li>{2}<a href='{3}/ArticleList.aspx?BlogId={0}'>{1}</a></li>",
                    info.Id,
                    info.Name,
                    s,
                    this.RootUrl)
                    );
                
            }
            Response.Write("</ul>");

            if (SecurityUtility.IsBlogAdmin && this.IsMasterMode)
            {
    %>
        <button>删除</button>
    <%
            }
        }
    %>
    </div>
    </form>
    
    <div><% //new CreateBlog(); %></div>
</div>

<script type="text/javascript">
$(function(){
    // 绑定删除事件
    $("#FrmDeleteBlogs").ajaxSubmit( function(dat){alert(dat.response||dat.error||"")} );
    
});
</script>       
</body>
</html>